package com.tutucms.common.javamail;

import com.tutucms.common.util.ConfigFileUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * @author WangXuDong
 * @version 1.0
 */
@Slf4j
public class MailInfo {

    private static String email;
    private static String fromName;
    private static transient String password;
    private static String smtp;
    private static String port;
    private static boolean isEncryp;
    private static boolean isDebug;

    static {
        init();
    }

    public static void init() {
        Map<String, String> conf = ConfigFileUtil.readPropertiesConfig("wxd.javamail");
        email = conf.get("email");
        password = conf.get("password");
        smtp = conf.get("smtp");
        port = conf.get("port");
        fromName = conf.get("fromName");
        isEncryp = Boolean.parseBoolean(conf.get("isencryp"));
        isDebug = Boolean.parseBoolean(conf.get("debug"));

    }

    public static String getEmail() {
        return email;
    }

    public static String getPassword() {
        return password;
    }

    public static String getSmtp() {
        return smtp;
    }

    public static String getPort() {
        return port;
    }

    public static boolean isEncryp() {
        return isEncryp;
    }

    public static boolean isDebug() {
        return isDebug;
    }

    public static String getFromName() {
        return fromName;
    }

    public static void setFromName(String fromName) {
        MailInfo.fromName = fromName;
    }
}
